<template>
    <el-button type="primary"  @click="make">测试</el-button>
</template>

<script>
    import request from "../utils/request";

    export default {
        name: 'Test',
        data() {
            return {
                form: {},
                active: "",
                dialogVisible: false,
                dialogTitle: "",
                content: "Some initial content",
                formType: '',
                paper:{},
            }
        },
        created() {
            // this.form.name = "Test";
            var vm = this;
        },
        methods: {
            save() {
                this.$message.info(this.content);
                this.dialogVisible = false;
                this.form[this.formType] = this.content;
                this.content = "";
            },
            focus(formType) {
                this.formType = formType
                this.dialogVisible = true;
            },
            greet() {
                console.log("form", this.form);
                // console.log(JSON.stringify(this.form))
            },
            make(){
                this.setPaper();
                request.post('/question/randomPaper', this.paper).then(res => {
                    console.log("code:", res.code)
                    if (res.code == '200') {
                        this.paper["questionList"] = res.data;
                        console.log('this.form.questionList', this.paper["questionList"])
                    } else {
                        this.$message.error("获取试卷失败")
                    }
                })
            },
            setPaper() {
                this.paper = {
                    "paperId": 164,
                    "paperName": "数据库随机卷",
                    "score": "0",
                    "courseId": "1",
                    "courseName": "数据库Mysql",
                    "questionCount": null,
                    "radioQuestionCount": 10,
                    "checkboxQuestionCount": 8,
                    "judgeQuestionCount": 10,
                    "fillQuestionCount": 0,
                    "objectiveQuestionCount": 0,
                    "suggestTime": 5,
                    "limitStartTime": null,
                    "limitEndTime": null,
                    "address": null,
                    "teacherId": "123456",
                    "teacherName": null,
                    "createTime": "2022-04-17T08:55:34.000+00:00",
                    "paperType": 1,
                    "difficult": 3,
                    "makePaperMethod": 2,
                    "radioScore": "3",
                    "checkboxScore": "5",
                    "judgeScore": "3",
                    "paperScore": null,
                    "questionList": null,
                    "useStatus": "1"
                };
            },
        }

    }
    ;
</script>
